package com.icart.repositories;


import com.icart.entities.BiMsgEntity;
import com.icart.entities.CuCustinfoEntity;
import org.springframework.context.annotation.Scope;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
@Scope("prototype")
public interface MessageRepository extends BaseRepository<BiMsgEntity,Integer> {
    @Transactional
    @Query(nativeQuery = true,value = "update bi_msg set readstat=1 where msgid=?1 and objid=?2")
    @Modifying(clearAutomatically = true)
    Integer update(Long msgid,String objid);

    @Transactional
    @Query(nativeQuery = true,value = "delete from bi_msg  where msgid=?1 ")
    @Modifying(clearAutomatically = true)
    Integer delete(Long msgid);
}

